fix(ci): don't validate company files a PR removed - #2255
Merged
dougaitken merged 1 commit intoSep 7, 2026
Conversation
The Validate Company Profiles workflow built its file list from `gh pr diff --name-only`, which reports both the old and new path when a PR renames a company profile. The old path is absent from the sparse pr-head checkout, so validate-companies.js failed with ENOENT and blocked the PR over a file it had legitimately deleted. Any PR removing a profile hit the same wall. List changed files through the pulls API instead and drop entries with status "removed", so only files present in the checkout are validated. Verified against remoteintech#2247 (rename -> yields only the added file) and remoteintech#2249 (edit -> unchanged behaviour). Also guards the mapping loop with a warning rather than a silent skip, and short-circuits cleanly when nothing is left to validate. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MMca9WXKJAriMEfghGw1eT
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Surfaced while reviewing #2247, but fixed independently since it affects every contributor PR of this shape.
The bug
validate-companies.ymlbuilt its file list fromgh pr diff --name-only. On a rename that returns both paths:The mapping loop then prefixes each with
pr-head/, but the deleted file isn't in the sparse head checkout, sovalidate-companies.jsfailed:That's an unconditional
exit 1, so the workflow blocked the PR over a file it had legitimately deleted — while the file it actually added validated clean. Any PR removing a profile hit the same wall.The fix
List changed files through the pulls API and drop
removedentries, so only paths present in the checkout are validated. This is preferable to just testing-fon each path, which would mask a genuinely missing file.Verified against the live PRs:
redlio-labs.mdonlysoshace.mdsoshace.md(unchanged)first-point.mdfirst-point.md(unchanged)The mapping loop keeps a
-fcheck as defence-in-depth, but now emits::warning::instead of skipping silently, and the step short-circuits cleanly if nothing is left to validate (the comment step already returns early on an empty result, so no comment is posted).Verification
YAML parses, mapping-loop logic exercised locally across rename / all-missing / multi-file cases, and
npm run buildis clean (981 files).Credit to @mayursinh1211, who diagnosed this correctly on #2247.
🤖 Generated with Claude Code
https://claude.ai/code/session_01MMca9WXKJAriMEfghGw1eT